@include "best.awk"

function keep(t,  r,k) {
    r= t["rows"]
    k = t[r][t["cols"]]
    for(c in t["use"])
        if(c in t["nonclass"]) 
            (c in t["num"] ? num(t,k,t[r][c],c) : sym(t,k,t[r][c],c))
}
function num(t,k,val,c) {    
    t["n"    ][k][c]++
    t["sum"  ][k][c] += val
    t["sumSq"][k][c] += val * val
}
function sym(t,k,val,c,n) {
    n =   ++t["count"   ][k][c][val]
    if (n > t["countMax"][k][c]) {
            t["countMax"][k][c] = n
            t["countSym"][k][c] = val
}}
